import G6 from '@antv/g6';

const graph = new G6.Graph({
  container: 'container',
  width: 800,
  height: 600,
  layout: { type: 'dagre', rankdir: 'LR' }, // 从左到右的布局
  defaultNode: { type: 'rect', size: [120, 40], style: { radius: 4 } },
  defaultEdge: { style: { endArrow: true } }
});

graph.data({
  nodes: [
    { id: 'root', label: '识别速度慢\n准确率低' },
    { id: 'n1', label: '检测评估差' },
    { id: 'n2', label: '数据质量差' },
    // 其他节点...
  ],
  edges: [
    { source: 'n1', target: 'root' },
    { source: 'n2', target: 'n1' },
    // 其他边...
  ]
});

graph.render();
